// eslint-disable-next-line @typescript-eslint/no-var-requires
const MiniCssExtractPlugin=require('mini-css-extract-plugin');const path=require('path')
module.exports = {
	productionSourceMap: false,
  outputDir:'dist',
  devServer: {
    open: process.platform === 'darwin',
    host: '127.0.0.1',
    port: 3000,
    https: false,
    hotOnly: false,
    proxy: null,
    before: app => {
      app.mountpath='/dist';console.log(app.settings)
    }
  },
  lintOnSave: false,
  publicPath: process.env.ENV === 'win' ?  "././":'/' ,
  configureWebpack: config => {
    config.output.filename = 's/js/[name].[hash:8].js'
    config.output.chunkFilename = 's/js/[name].[hash:8].js'
    config.entry = ["@babel/polyfill", "./src/main.ts", "./src/interface/index.ts"];
  },
  chainWebpack: config => {
    config.resolve.alias.set('@', path.join(__dirname,'src'))
      .set('assets', path.join(__dirname,'src/assets'))
      .set('components', path.join(__dirname,'src/components'))
    config.plugin('extract-css').use(new MiniCssExtractPlugin({
      filename: 's/css/[name].[hash:8].css',
      chunkFilename: 's/css/[name].[hash:8].css'
    }))
    config.module.rule('images')
      .test(/\.(png|jpe?g|gif|webp)(\?.*)?$/)
      .use('url-loader')
      .loader('file-loader')
      .options({
          name: 's/img/[name].[hash:8].[ext]'
      })
    config.module.rule('svg')
      .test(/\.(svg)(\?.*)?$/)
      .use('file-loader')
      .loader('file-loader')
      .options({
          name: 's/img/[name].[hash:8].[ext]'
      })
  },
}